Optimal. Leaf size=191 \[ -\frac {3 \sqrt {b} \sqrt {a+b} (a+2 b) \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{2 a^4 f}-\frac {3 b (3 a+4 b) \tan (e+f x)}{8 a^3 f \left (a+b \tan ^2(e+f x)+b\right )}-\frac {(5 a+6 b) \sin (e+f x) \cos (e+f x)}{8 a^2 f \left (a+b \tan ^2(e+f x)+b\right )}+\frac {3 x \left (a^2+8 a b+8 b^2\right )}{8 a^4}+\frac {\sin (e+f x) \cos ^3(e+f x)}{4 a f \left (a+b \tan ^2(e+f x)+b\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.26, antiderivative size = 191, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.261, Rules used = {4132, 470, 527, 522, 203, 205} \[ \frac {3 x \left (a^2+8 a b+8 b^2\right )}{8 a^4}-\frac {3 \sqrt {b} \sqrt {a+b} (a+2 b) \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{2 a^4 f}-\frac {3 b (3 a+4 b) \tan (e+f x)}{8 a^3 f \left (a+b \tan ^2(e+f x)+b\right )}-\frac {(5 a+6 b) \sin (e+f x) \cos (e+f x)}{8 a^2 f \left (a+b \tan ^2(e+f x)+b\right )}+\frac {\sin (e+f x) \cos ^3(e+f x)}{4 a f \left (a+b \tan ^2(e+f x)+b\right )} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 203
Rule 205
Rule 470
Rule 522
Rule 527
Rule 4132
Rubi steps
\begin {align*} \int \frac {\sin ^4(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx &=\frac {\operatorname {Subst}\left (\int \frac {x^4}{\left (1+x^2\right )^3 \left (a+b+b x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {\cos ^3(e+f x) \sin (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )}-\frac {\operatorname {Subst}\left (\int \frac {a+b+(-4 a-5 b) x^2}{\left (1+x^2\right )^2 \left (a+b+b x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{4 a f}\\ &=-\frac {(5 a+6 b) \cos (e+f x) \sin (e+f x)}{8 a^2 f \left (a+b+b \tan ^2(e+f x)\right )}+\frac {\cos ^3(e+f x) \sin (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )}+\frac {\operatorname {Subst}\left (\int \frac {3 (a+b) (a+2 b)-3 b (5 a+6 b) x^2}{\left (1+x^2\right ) \left (a+b+b x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{8 a^2 f}\\ &=-\frac {(5 a+6 b) \cos (e+f x) \sin (e+f x)}{8 a^2 f \left (a+b+b \tan ^2(e+f x)\right )}+\frac {\cos ^3(e+f x) \sin (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )}-\frac {3 b (3 a+4 b) \tan (e+f x)}{8 a^3 f \left (a+b+b \tan ^2(e+f x)\right )}+\frac {\operatorname {Subst}\left (\int \frac {6 (a+b)^2 (a+4 b)-6 b (a+b) (3 a+4 b) x^2}{\left (1+x^2\right ) \left (a+b+b x^2\right )} \, dx,x,\tan (e+f x)\right )}{16 a^3 (a+b) f}\\ &=-\frac {(5 a+6 b) \cos (e+f x) \sin (e+f x)}{8 a^2 f \left (a+b+b \tan ^2(e+f x)\right )}+\frac {\cos ^3(e+f x) \sin (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )}-\frac {3 b (3 a+4 b) \tan (e+f x)}{8 a^3 f \left (a+b+b \tan ^2(e+f x)\right )}-\frac {(3 b (a+b) (a+2 b)) \operatorname {Subst}\left (\int \frac {1}{a+b+b x^2} \, dx,x,\tan (e+f x)\right )}{2 a^4 f}+\frac {\left (3 \left (a^2+8 a b+8 b^2\right )\right ) \operatorname {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{8 a^4 f}\\ &=\frac {3 \left (a^2+8 a b+8 b^2\right ) x}{8 a^4}-\frac {3 \sqrt {b} \sqrt {a+b} (a+2 b) \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{2 a^4 f}-\frac {(5 a+6 b) \cos (e+f x) \sin (e+f x)}{8 a^2 f \left (a+b+b \tan ^2(e+f x)\right )}+\frac {\cos ^3(e+f x) \sin (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )}-\frac {3 b (3 a+4 b) \tan (e+f x)}{8 a^3 f \left (a+b+b \tan ^2(e+f x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 13.24, size = 1105, normalized size = 5.79 \[ -\frac {(\cos (2 e+2 f x) a+a+2 b)^2 \left (16 x+\frac {\left (-a^3+6 b a^2+24 b^2 a+16 b^3\right ) \tan ^{-1}\left (\frac {\sec (f x) (\cos (2 e)-i \sin (2 e)) (a \sin (2 e+f x)-(a+2 b) \sin (f x))}{2 \sqrt {a+b} \sqrt {b (\cos (e)-i \sin (e))^4}}\right ) (\cos (2 e)-i \sin (2 e))}{b (a+b)^{3/2} f \sqrt {b (\cos (e)-i \sin (e))^4}}+\frac {\left (a^2+8 b a+8 b^2\right ) ((a+2 b) \sin (2 e)-a \sin (2 f x))}{b (a+b) f (\cos (2 (e+f x)) a+a+2 b) (\cos (e)-\sin (e)) (\cos (e)+\sin (e))}\right ) \sec ^4(e+f x)}{256 a^2 \left (b \sec ^2(e+f x)+a\right )^2}+\frac {3 (\cos (2 e+2 f x) a+a+2 b)^2 \left (\frac {(a+2 b) \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{(a+b)^{3/2}}-\frac {a \sqrt {b} \sin (2 (e+f x))}{(a+b) (\cos (2 (e+f x)) a+a+2 b)}\right ) \sec ^4(e+f x)}{1024 b^{3/2} f \left (b \sec ^2(e+f x)+a\right )^2}+\frac {(\cos (2 e+2 f x) a+a+2 b)^2 \left (\frac {\sec (2 e) \left (\sin (2 e) a^5-\sin (2 f x) a^5+80 b f x \cos (4 e+2 f x) a^4+34 b \sin (2 e) a^4-62 b \sin (2 f x) a^4-12 b \sin (2 (e+2 f x)) a^4-30 b \sin (4 e+2 f x) a^4-12 b \sin (6 e+4 f x) a^4+2 b \sin (4 e+6 f x) a^4+2 b \sin (8 e+6 f x) a^4+464 b^2 f x \cos (4 e+2 f x) a^3+224 b^2 \sin (2 e) a^3-318 b^2 \sin (2 f x) a^3-36 b^2 \sin (2 (e+2 f x)) a^3-158 b^2 \sin (4 e+2 f x) a^3-36 b^2 \sin (6 e+4 f x) a^3+2 b^2 \sin (4 e+6 f x) a^3+2 b^2 \sin (8 e+6 f x) a^3+768 b^3 f x \cos (4 e+2 f x) a^2+576 b^3 \sin (2 e) a^2-512 b^3 \sin (2 f x) a^2-24 b^3 \sin (2 (e+2 f x)) a^2-256 b^3 \sin (4 e+2 f x) a^2-24 b^3 \sin (6 e+4 f x) a^2+16 b \left (5 a^3+29 b a^2+48 b^2 a+24 b^3\right ) f x \cos (2 f x) a+384 b^4 f x \cos (4 e+2 f x) a+640 b^4 \sin (2 e) a-256 b^4 \sin (2 f x) a-128 b^4 \sin (4 e+2 f x) a+32 b \left (5 a^4+39 b a^3+106 b^2 a^2+120 b^3 a+48 b^4\right ) f x \cos (2 e)+256 b^5 \sin (2 e)\right )}{\cos (2 (e+f x)) a+a+2 b}-\frac {\left (a^5-30 b a^4-480 b^2 a^3-1600 b^3 a^2-1920 b^4 a-768 b^5\right ) \tan ^{-1}\left (\frac {\sec (f x) (\cos (2 e)-i \sin (2 e)) (a \sin (2 e+f x)-(a+2 b) \sin (f x))}{2 \sqrt {a+b} \sqrt {b (\cos (e)-i \sin (e))^4}}\right ) (\cos (2 e)-i \sin (2 e))}{\sqrt {a+b} \sqrt {b (\cos (e)-i \sin (e))^4}}\right ) \sec ^4(e+f x)}{1024 a^4 b (a+b) f \left (b \sec ^2(e+f x)+a\right )^2} \]
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.62, size = 522, normalized size = 2.73 \[ \left [\frac {3 \, {\left (a^{3} + 8 \, a^{2} b + 8 \, a b^{2}\right )} f x \cos \left (f x + e\right )^{2} + 3 \, {\left (a^{2} b + 8 \, a b^{2} + 8 \, b^{3}\right )} f x + 3 \, {\left ({\left (a^{2} + 2 \, a b\right )} \cos \left (f x + e\right )^{2} + a b + 2 \, b^{2}\right )} \sqrt {-a b - b^{2}} \log \left (\frac {{\left (a^{2} + 8 \, a b + 8 \, b^{2}\right )} \cos \left (f x + e\right )^{4} - 2 \, {\left (3 \, a b + 4 \, b^{2}\right )} \cos \left (f x + e\right )^{2} + 4 \, {\left ({\left (a + 2 \, b\right )} \cos \left (f x + e\right )^{3} - b \cos \left (f x + e\right )\right )} \sqrt {-a b - b^{2}} \sin \left (f x + e\right ) + b^{2}}{a^{2} \cos \left (f x + e\right )^{4} + 2 \, a b \cos \left (f x + e\right )^{2} + b^{2}}\right ) + {\left (2 \, a^{3} \cos \left (f x + e\right )^{5} - {\left (5 \, a^{3} + 6 \, a^{2} b\right )} \cos \left (f x + e\right )^{3} - 3 \, {\left (3 \, a^{2} b + 4 \, a b^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{8 \, {\left (a^{5} f \cos \left (f x + e\right )^{2} + a^{4} b f\right )}}, \frac {3 \, {\left (a^{3} + 8 \, a^{2} b + 8 \, a b^{2}\right )} f x \cos \left (f x + e\right )^{2} + 3 \, {\left (a^{2} b + 8 \, a b^{2} + 8 \, b^{3}\right )} f x + 6 \, {\left ({\left (a^{2} + 2 \, a b\right )} \cos \left (f x + e\right )^{2} + a b + 2 \, b^{2}\right )} \sqrt {a b + b^{2}} \arctan \left (\frac {{\left (a + 2 \, b\right )} \cos \left (f x + e\right )^{2} - b}{2 \, \sqrt {a b + b^{2}} \cos \left (f x + e\right ) \sin \left (f x + e\right )}\right ) + {\left (2 \, a^{3} \cos \left (f x + e\right )^{5} - {\left (5 \, a^{3} + 6 \, a^{2} b\right )} \cos \left (f x + e\right )^{3} - 3 \, {\left (3 \, a^{2} b + 4 \, a b^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{8 \, {\left (a^{5} f \cos \left (f x + e\right )^{2} + a^{4} b f\right )}}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.35, size = 204, normalized size = 1.07 \[ \frac {\frac {3 \, {\left (a^{2} + 8 \, a b + 8 \, b^{2}\right )} {\left (f x + e\right )}}{a^{4}} - \frac {12 \, {\left (a^{2} b + 3 \, a b^{2} + 2 \, b^{3}\right )} {\left (\pi \left \lfloor \frac {f x + e}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\relax (b) + \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b + b^{2}}}\right )\right )}}{\sqrt {a b + b^{2}} a^{4}} - \frac {4 \, {\left (a b \tan \left (f x + e\right ) + b^{2} \tan \left (f x + e\right )\right )}}{{\left (b \tan \left (f x + e\right )^{2} + a + b\right )} a^{3}} - \frac {5 \, a \tan \left (f x + e\right )^{3} + 8 \, b \tan \left (f x + e\right )^{3} + 3 \, a \tan \left (f x + e\right ) + 8 \, b \tan \left (f x + e\right )}{{\left (\tan \left (f x + e\right )^{2} + 1\right )}^{2} a^{3}}}{8 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.89, size = 323, normalized size = 1.69 \[ -\frac {b \tan \left (f x +e \right )}{2 a^{2} f \left (a +b +b \left (\tan ^{2}\left (f x +e \right )\right )\right )}-\frac {3 b \arctan \left (\frac {\tan \left (f x +e \right ) b}{\sqrt {\left (a +b \right ) b}}\right )}{2 f \,a^{2} \sqrt {\left (a +b \right ) b}}-\frac {9 b^{2} \arctan \left (\frac {\tan \left (f x +e \right ) b}{\sqrt {\left (a +b \right ) b}}\right )}{2 f \,a^{3} \sqrt {\left (a +b \right ) b}}-\frac {b^{2} \tan \left (f x +e \right )}{2 f \,a^{3} \left (a +b +b \left (\tan ^{2}\left (f x +e \right )\right )\right )}-\frac {3 b^{3} \arctan \left (\frac {\tan \left (f x +e \right ) b}{\sqrt {\left (a +b \right ) b}}\right )}{f \,a^{4} \sqrt {\left (a +b \right ) b}}-\frac {\left (\tan ^{3}\left (f x +e \right )\right ) b}{f \,a^{3} \left (1+\tan ^{2}\left (f x +e \right )\right )^{2}}-\frac {5 \left (\tan ^{3}\left (f x +e \right )\right )}{8 f \,a^{2} \left (1+\tan ^{2}\left (f x +e \right )\right )^{2}}-\frac {3 \tan \left (f x +e \right )}{8 f \,a^{2} \left (1+\tan ^{2}\left (f x +e \right )\right )^{2}}-\frac {\tan \left (f x +e \right ) b}{f \,a^{3} \left (1+\tan ^{2}\left (f x +e \right )\right )^{2}}+\frac {3 \arctan \left (\tan \left (f x +e \right )\right ) b}{f \,a^{3}}+\frac {3 \arctan \left (\tan \left (f x +e \right )\right ) b^{2}}{f \,a^{4}}+\frac {3 \arctan \left (\tan \left (f x +e \right )\right )}{8 f \,a^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.48, size = 205, normalized size = 1.07 \[ -\frac {\frac {3 \, {\left (3 \, a b + 4 \, b^{2}\right )} \tan \left (f x + e\right )^{5} + {\left (5 \, a^{2} + 24 \, a b + 24 \, b^{2}\right )} \tan \left (f x + e\right )^{3} + 3 \, {\left (a^{2} + 5 \, a b + 4 \, b^{2}\right )} \tan \left (f x + e\right )}{a^{3} b \tan \left (f x + e\right )^{6} + {\left (a^{4} + 3 \, a^{3} b\right )} \tan \left (f x + e\right )^{4} + a^{4} + a^{3} b + {\left (2 \, a^{4} + 3 \, a^{3} b\right )} \tan \left (f x + e\right )^{2}} - \frac {3 \, {\left (a^{2} + 8 \, a b + 8 \, b^{2}\right )} {\left (f x + e\right )}}{a^{4}} + \frac {12 \, {\left (a^{2} b + 3 \, a b^{2} + 2 \, b^{3}\right )} \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {{\left (a + b\right )} b}}\right )}{\sqrt {{\left (a + b\right )} b} a^{4}}}{8 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 5.77, size = 435, normalized size = 2.28 \[ \frac {3\,\mathrm {atanh}\left (\frac {27\,b^3\,\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-b^2-a\,b}}{64\,\left (\frac {27\,a\,b^3}{64}+\frac {81\,b^4}{64}+\frac {27\,b^5}{32\,a}\right )}+\frac {27\,b^4\,\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-b^2-a\,b}}{32\,\left (\frac {27\,a^2\,b^3}{64}+\frac {81\,a\,b^4}{64}+\frac {27\,b^5}{32}\right )}\right )\,\left (a+2\,b\right )\,\sqrt {-b\,\left (a+b\right )}}{2\,a^4\,f}-\frac {\frac {3\,{\mathrm {tan}\left (e+f\,x\right )}^5\,\left (4\,b^2+3\,a\,b\right )}{8\,a^3}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^3\,\left (5\,a^2+24\,a\,b+24\,b^2\right )}{8\,a^3}+\frac {3\,\mathrm {tan}\left (e+f\,x\right )\,\left (a^2+5\,a\,b+4\,b^2\right )}{8\,a^3}}{f\,\left (b\,{\mathrm {tan}\left (e+f\,x\right )}^6+\left (a+3\,b\right )\,{\mathrm {tan}\left (e+f\,x\right )}^4+\left (2\,a+3\,b\right )\,{\mathrm {tan}\left (e+f\,x\right )}^2+a+b\right )}-\frac {\mathrm {atan}\left (\frac {27\,b^2\,\mathrm {tan}\left (e+f\,x\right )}{256\,\left (\frac {27\,b^2}{256}+\frac {243\,b^3}{256\,a}+\frac {27\,b^4}{16\,a^2}+\frac {27\,b^5}{32\,a^3}\right )}+\frac {243\,b^3\,\mathrm {tan}\left (e+f\,x\right )}{256\,\left (\frac {27\,a\,b^2}{256}+\frac {243\,b^3}{256}+\frac {27\,b^4}{16\,a}+\frac {27\,b^5}{32\,a^2}\right )}+\frac {27\,b^4\,\mathrm {tan}\left (e+f\,x\right )}{16\,\left (\frac {243\,a\,b^3}{256}+\frac {27\,b^4}{16}+\frac {27\,a^2\,b^2}{256}+\frac {27\,b^5}{32\,a}\right )}+\frac {27\,b^5\,\mathrm {tan}\left (e+f\,x\right )}{32\,\left (\frac {27\,a^3\,b^2}{256}+\frac {243\,a^2\,b^3}{256}+\frac {27\,a\,b^4}{16}+\frac {27\,b^5}{32}\right )}\right )\,\left (a^2\,1{}\mathrm {i}+a\,b\,8{}\mathrm {i}+b^2\,8{}\mathrm {i}\right )\,3{}\mathrm {i}}{8\,a^4\,f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-1)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________